package com.airticketbooking.service.serviceImpl;

import com.airticketbooking.common.domain.PageQuery;
import com.airticketbooking.po.Airport;
import com.airticketbooking.mapper.AirportMapper;
import com.airticketbooking.service.AirportService;
import com.github.pagehelper.PageHelper;
import lombok.RequiredArgsConstructor;
import org.springframework.data.domain.Page;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author Mr.J
 * @version 1.0.0
 * @date 2024/10/9
 * @desc
 */
@Service
@RequiredArgsConstructor
public class AirportServiceImpl implements AirportService {

	private final AirportMapper aiportsMapper;


	//	根据航站楼名称查询航站楼信息
	@Override
	public Airport getAirportById(Integer airportId) {

		return aiportsMapper.getAirportById(airportId);

	}

	@Override
	public Page<Airport> queryByPage(PageQuery query) {
		PageHelper.startPage(query.getPageNo(), query.getPageSize());

		Page<Airport> airportsPageInfo = aiportsMapper.queryByPage(query);

		return airportsPageInfo;
	}

	@Override
	public List<Airport> getAirports() {
		return aiportsMapper.getAirports();
	}
}